/*******************************************************************************
*  ajax.js : 2006.08.09
* -----------------------------------------------------------------------------
*  AJAX-related functions
*******************************************************************************/

function AjaxContainer ()
{
	var xmlHttp = null;
	var content = null;
	var content_wait = 0;
	var response_handler = null;

	var getXmlHttpObject = function () {
		try {
			// Firefox, Opera 8.0+, Safari, IE7+
			xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
		} catch (e) {
			// Internet Explorer
			try {
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		if ( xmlHttp != null ) {
			xmlHttp.onreadystatechange = function () {
				if (xmlHttp.readyState == 4) {
					try {
						if (xmlHttp.status == 200) {
							content = xmlHttp.responseText;
						}
					} catch (e) {
						content = "Error connecting to server.";
					}
				}
			}
		}
	}

	var getResponse = function () {
		if ( content == null ) {
			if ( 
			else {
				content_wait = content_wait + 1;
				setTimeout( 'getResponse()', 250 );
			}
		}
		return content;
	}

	this.getByURL = function ( handler, url, method, form ) {
		if (( typeof( url )).toLowerCase() != 'function' ) { return ( null ); }		
		if (( typeof( url )).toLowerCase() == 'undefined' ) { return ( null ); }		
		if (( typeof( method )).toLowerCase() == 'undefined' ) { method = "get"; }
		if (( typeof( form )).toLowerCase() == 'undefined' ) { form = null;  }
		if ( xmlHTTP != null )
		{
			content = null;
			content_wait = 0;
			xmlHttp.open( method, url );
			xmlHttp.send( form );
			getResponse();
			while ( content == null && content_wait < 4 ) {
				;
			}
			if ( content == null ) {
				return ( "Server did not respond in time." );
			}
			else {
				return ( content );
			}
		}
	}

	getXmlHttpObject();
}


/******************************************************************************/